package model.effect;

import model.entity.BasicEntity;
import utilities.*;

/**
 * This class represents the effect that changes a specified stat by a static amount
 */
public class ConstantChangeStatEffect extends ChangeStatEffect implements Archiveable
{

	/* --------------------------------------------------------------------------------
	 * Constructors
	   -------------------------------------------------------------------------------- */	
	
	/**
	 * @param name The name of this model
	 * @param statType The name of the Stat that will be modified by this effect
	 * @param amountChanged The amount the stat will be changed (positive or negative)
	 */
	public ConstantChangeStatEffect(String name, String statType, int amountChanged) {
		super(name, statType, amountChanged);
	}

	public ConstantChangeStatEffect() {}

	/* --------------------------------------------------------------------------------
	 * Class methods
	   -------------------------------------------------------------------------------- */
	@Override
	public void doEffect(BasicEntity ent) 
	{
		if( ent.getStats() == null) { return ; }
		ent.getStats().addConstantModifier(super.getStatType(), super.getAmountChanged());
	}

	@Override
	public String toString()
	{
		return super.toString() + "StaticChangeStatEffect []";
	}
	
	public Archive save() {
		Archive archive = super.save();
		
		return archive;
	}
	
	public void load(Archive archive) {
		super.load(archive);
	}
	
}
